// 顾客端路由配置
import { RouteRecordRaw } from 'vue-router';

const customerRoutes: RouteRecordRaw[] = [
  {
    path: "/customer",
    name: "CustomerHome",
    component: () => import("@/views/customer/HomeView.vue"),
    meta: { title: '饱了么 - 美食外卖平台', requiresAuth: false }
  },
  {
    path: "/customer/login",
    name: "CustomerLogin",
    component: () => import("@/views/customer/LoginView.vue"),
    meta: { 
      title: '用户登录', 
      requiresAuth: false, 
      redirectIfLoggedIn: true,
      role: "user" 
    }
  },
  {
    path: "/customer/register",
    name: "CustomerRegister",
    component: () => import("@/views/customer/RegisterView.vue"),
    meta: { 
      title: '用户注册', 
      requiresAuth: false 
    }
  },
  {
    path: "/customer/store/:id",
    name: "StoreDetail",
    component: () => import("@/views/customer/StoreDetailView.vue"),
    meta: { title: '店铺详情', requiresAuth: false }
  },
  {
    path: "/customer/cart",
    name: "Cart",
    component: () => import("@/views/customer/CartView.vue"),
    meta: { title: '我的购物车', requiresAuth: true, role: "user" }
  },
  {
    path: "/customer/checkout",
    name: "Checkout",
    component: () => import("@/views/customer/CheckoutView.vue"),
    meta: { title: '订单结算', requiresAuth: true, role: "user" }
  },
  {
    path: "/customer/orders",
    name: "CustomerOrders",
    component: () => import("@/views/customer/OrdersViewNew.vue"),
    meta: { title: '我的订单', requiresAuth: true, role: "user" }
  },
  {
    path: "/customer/order/:id",
    name: "CustomerOrderDetail",
    component: () => import("@/views/customer/OrderDetailView.vue"),
    meta: { title: '订单详情', requiresAuth: true, role: "user" }
  },
  {
    path: "/customer/order/:id/review",
    name: "CustomerOrderReview",
    component: () => import("@/views/customer/OrderReviewView.vue"),
    meta: { title: '评价订单', requiresAuth: true, role: "user" }
  },
    {
      path: "/customer/profile",
      name: "CustomerProfile",
      component: () => import("@/views/customer/ProfileView.vue"),
      meta: { title: '个人中心', requiresAuth: true, role: "user" }
    },
    {
      path: "/customer/addresses",
      name: "Addresses",
      component: () => import("@/views/customer/AddressView.vue"),
      meta: { title: '地址管理', requiresAuth: true, role: "user" }
    },
    {
      path: "/customer/favorites/stores",
      name: "FavoriteStores",
      component: () => import("@/views/customer/FavoriteStoresView.vue"),
      meta: { title: '收藏的店铺', requiresAuth: true, role: "user" }
    },
    {
      path: "/customer/favorites/foods",
      name: "FavoriteFoods",
      component: () => import("@/views/customer/FavoriteFoodsView.vue"),
      meta: { title: '收藏的商品', requiresAuth: true, role: "user" }
    },
    {
      path: "/customer/history",
      name: "BrowseHistory",
      component: () => import("@/views/customer/HistoryView.vue"),
      meta: { title: '浏览历史', requiresAuth: true, role: "user" }
    },
    {
      path: "/customer/stores",
      name: "StoreList",
      component: () => import("@/views/customer/StoreListView.vue"),
      meta: { title: '商家列表', requiresAuth: false }
    },
    {
      path: "/customer/search",
      name: "Search",
      component: () => import("@/views/customer/SearchView.vue"),
      meta: { title: '搜索结果', requiresAuth: false }
    }
];

export default customerRoutes;
